Skip to content

Conversation

@edoardocavazza
Copy link

@edoardocavazza edoardocavazza commented Oct 2, 2025

Attempt to fix #20324

Tree nodes are collected bottom-up, so I think it is safe when a list or table item is collected, to collect its children too


const element = new StructElementNode(this, dict);
map.set(dict, element);
switch (element.role) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test to make sure that this behavior can't regress in the future.

@timvandermeij timvandermeij changed the title Collect all child nodes of lists and tables in StrucTree Collect all child nodes of lists and tables in StructTree Oct 5, 2025
@calixteman
Copy link
Contributor

I need to think about that: I'm not sure it's the right approach.
I've a patch too for the original issue but I'm not sure it's the right approach too...

@edoardocavazza
Copy link
Author

Added a unit test case

"lastPage": 1,
"type": "eq"
},
{ "id": "issue20324",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file are useless.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was created running the add_test script so I thought it was needed somewhere. I'll revert it!

await loadingTask.destroy();
});

it("should collect all list and table items in StructTree", async function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any specific reason to have this test in this file instead of struct_tree_spec ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I'll move it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Missing empty struct nodes via getStructTree

3 participants